package com.cy.mapper;


import com.cy.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {

    @Select("select*from user")
    List<User> selectAll();

    @Insert("insert into mybatis_study.user value (null,'张鹏宇',18)")
    int insertUser();

    @Update(("update mybatis_study.user set age=30 where name='张楚岚'"))
    int update();

    @Delete("delete from mybatis_study.user where name='张鹏宇'")
    int deleteUser();

    @Update("update mybatis_study.user set age=#{age} where name='张楚岚'")
    int updateUser(int age);

    //注解方式 不可以传入多种参数
    @Update(("update mybatis_study.user set name=#{name}, age=#{age} where id=4"))
    int updateUser1(@Param("name") int age,@Param("age") String name);
}
